import request from "@/utils/request.ts";
import { reqBaseData } from "@/api/type";
import { reqUpload, ResponsePage, ResponsePeaInfo } from "@/api/credit/peasants/pea-message/type";
import data from "@/views/system/dict/data.vue";
import { a } from "pinia-plugin-persistedstate/dist/types-374a3a36";


enum API {
  CRE_PEA_UPLOAD_IMAGE_URL = '/credit/peasants/upload/idCardOther', //上传身份证，签字等图片，单图片上传
  CRE_PEA_ADD_URL = '/credit/peasants/add', // 添加农户信息
  CRE_PEA_EDIT_URL = '/credit/peasants/edit', // 添加农户信息
  CRE_PEA_LIST_URL = '/credit/peasants/list', // 分页查询
  CRE_PEA_INFO_URL = '/credit/peasants/info', // 根据HZID查询详情
  CRE_PEA_START_SCORING = '/credit/peasants/startScoring', // 根据HZID查询详情
}



// 身份证等信息的文件上传--单文件上传
export const reqUploadImage = (data: any) => {
  return request<any, reqUpload>({
    url: API.CRE_PEA_UPLOAD_IMAGE_URL,
    method: 'post',
    data: data,
  })
}

// 添加农户信息
export const reqCreAdd = (data: any) => {
  return request<any, reqBaseData>({
    url: API.CRE_PEA_ADD_URL,
    method: 'post',
    data: data,
  })
}

// 修改农户信息
export const reqCreEdit = (data: any) => {
  return request<any, reqBaseData>({
    url: API.CRE_PEA_EDIT_URL,
    method: 'post',
    data: data,
  })
}

// 分页查询
export const reqCrePeaPageUrl = (param: any) => {
  return request<any, ResponsePage>({
    url: API.CRE_PEA_LIST_URL,
    method: 'get',
    params: param,
  })
}


// 查询详细信息
export const reqCrePeaInfoByHzId = (hzId: any) => {
  return request<any, ResponsePeaInfo>({
    url: API.CRE_PEA_INFO_URL + '/' + hzId,
    method: 'get',
  })
}


// 开始评分
export const reqCrePeaStartScoring = (hzId: any) => {
  return request<any, any>({
    url: API.CRE_PEA_START_SCORING + '/' + hzId,
    method: 'put'
  })
}
